<style>

</style>
<?php $html->css('/assets/css/gallery.css',null,array(),false);?>		
		<?php 
				$loop = 1;
				foreach($listingAssets as $listingAsset){?>
				<div class="galleryImage" style="clear: none;margin-top: 10px;">
					<?php echo $asset->previewImage($listingAsset['ListingAsset'],array('thumb'=>array('width'=>'60','height'=>'60','crop'=>false)));?>
					<?php 
							if(!isset($allowDefaultSelect) || $allowDefaultSelect == true)						
							echo '<br />'.$form->input("ListingAsset.is_default",array('title'=>__("Set as default image for the listing"),'style'=>"marging-left:3px;","type"=>'radio','checked'=>$listingAsset['ListingAsset']['is_default'] ? 1:"",'options'=>array($listingAsset['ListingAsset']['id']=>""),'value'=>1,'div'=>false,'legend'=>false,'label'=>false,'div'=>false))
					?>
					<?php echo $html->link("",array("controller"=>"listing_assets",'action'=>"delete",$listingAsset['ListingAsset']['id']),array('style'=>"padding-top:0px !important","class"=>"delete_link crossIcon",'onclick'=>"return confirmAndAjaxCall(this,'".__("Are you sure you want to delete this image?")."')"));?>
				</div>
				<?php if($loop%3 == 0)
						echo '<div class="clear"></div>';
						$loop++;?>
		<?php } ?>
		<script>
			
				function confirmAndAjaxCall(caller,msg)
				{
					if(confirm(msg))
					{
						var fn = function(){
								if(typeof countCheck == "function")
										countCheck.call($('#asset_inputs_parent_field_add_more').parent()[0]);
						};
						$.get($(caller).attr("href"));
						$(caller).closest(".galleryImage").hide('slow',function(){
							$(this).remove();
							fn();
						});
						setTimeout(fn,200);
					}
					return false;
				}
		</script>